<template>
    <div class="son17">
        <h2>SonDemo17</h2>
        <!-- 网格布局 -->
        <div class="grid-box container">
            <template v-for="item in props.list" :key="item.id">
                <slot name="gridBoxItem" v-bind="item">
                    <div class="grid-box-item">
                        <div class="grid-card">
                            <div class="card-heard clearfix">
                                <img src="../../../assets/images/5.jpg" alt="" />
                                <div class="card-head-text fr">
                                    <div class="card-title">{{ item.title }}</div>
                                    <div class="card-icon">
                                        <img src="../../../assets/images/hot.png" alt="" />
                                        <span>用户:{{ item.user }}</span>
                                    </div>
                                    <div class="card-message">
                                        {{ item.descript }}
                                    </div>
                                </div>
                            </div>
                            <div class="card-footer clearfix">
                                <div class="footer-index fl"></div>
                                <button class="grid-btn fr">开始互动</button>
                            </div>
                        </div>
                    </div>
                </slot>
            </template>
        </div>

        <hr>
        <p>爷爷给的吃的：{{ props.cake }}</p>
        <SonSonDemo1 :cake2="props.cake"></SonSonDemo1>

    </div>
</template>

<script setup lang='ts'>
import { type IDemo45List } from '@/service/types/diyDemo45';
import { watchEffect } from 'vue';
import SonSonDemo1 from './SonSonDemo1.vue';

const props = defineProps<{
    list: IDemo45List[]
    cake: string
}>()

watchEffect(() => {
    console.log(props.list);
})

</script>

<style lang="scss" scoped>
.son17 {
    border: 3px solid deepskyblue;
    padding: 10px;
    margin: 10px;
}

/* #region  网格布局 */

.grid-box {
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.grid-box-item {
    border-radius: 5px;
    cursor: pointer;
}

.grid-card {
    padding: 16px;
    background-color: #fff;
    box-shadow:
        0 15px 35px -2px rgba(0, 0, 0, 0.05),
        0 5px 15px 0 rgba(0, 0, 0, 0.05);
}

.card-heard {
    height: 136px;
    display: flex;
}

.card-heard>img {
    float: left;
    width: 60px;
    height: 60px;
    margin-right: 12px;
    border-radius: 5px;
    vertical-align: middle;
}

.card-head-text {}

.card-title {
    height: 22px;
    margin-bottom: 8px;
    font-size: 18px;
}

.card-icon {
    height: 20px;
    margin-bottom: 8px;
}

.card-icon img {
    width: 26px;
    height: 16px;
    border-radius: 16px;
}

.card-icon span {
    color: #8a919f;
    font-size: 13px;
}

.card-message {
    height: 44px;
    color: #515767;
    font-size: 13px;
    line-height: 22px;
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    text-overflow: ellipsis;
    word-wrap: break-word;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-footer {
    height: 34px;
    padding-top: 12px;
    border-top: 1px solid #eaedf1;
}

.footer-index {
    width: 97px;
    height: 21px;
    background-color: palegoldenrod;
}

.grid-btn {
    border: 1px solid #b3d5ff;
    border-radius: 4px;
    padding: 2px 24px;
    color: #1e80ff;
    background-color: #f4f9ff;
    font-size: 12px;
    font-weight: 500;
}

/* #endregion 网格布局 */
</style>